package com.tanhua.server;

import com.tanhua.dubbo.api.UserApi;
import com.tanhua.interceptor.UserHolder;
import com.tanhua.model.dimain.User;
import com.tanhua.model.vo.HuanXinUserVo;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

/**
 * @author 杰哥不要啦~
 * @date 2021/10/30
 */
@Service
public class HuanXinService {
    @DubboReference
    private UserApi userApi;

    //查询当前用户的环信账号密码
    public  HuanXinUserVo findeHuanXinUser() {
        Long userid = UserHolder.getUserid();
        User user  = userApi.findById(userid);
        if (user == null){
            return null;
        }
        return new HuanXinUserVo(user.getHxUser(),user.getHxPassWord());
    }
}
